package com.uphone.magicleafteacher.pro.activity;

import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.uphone.magicleafteacher.R;
import com.uphone.magicleafteacher.base.BaseGActivity;
import com.uphone.magicleafteacher.util.CommonUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class DetailsJobActivity extends BaseGActivity {
    @BindView(R.id.img_hui)
    ImageView imgHui;
    @BindView(R.id.text_accomplish)
    TextView textAccomplish;
    @BindView(R.id.img_tu)
    ImageView imgTu;
    @BindView(R.id.img_redact)
    ImageView imgRedact;
    @BindView(R.id.img_text)
    ImageView imgText;

    @Override
    protected void initBundle() {

    }

    @Override
    protected int initLayout() {
        return R.layout.activity_detailsjob;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initTitle() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {

    }



    @OnClick({R.id.img_hui, R.id.text_accomplish, R.id.img_redact, R.id.img_text})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_hui:
                finish();
                break;
            //完成
            case R.id.text_accomplish:
                customDialog();

                break;
            //编辑
            case R.id.img_redact:

                break;
            //文字
            case R.id.img_text:

                break;
        }
    }

    private void customDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(DetailsJobActivity.this);
        AlertDialog alertDialog = builder.create();
        View inflate = View.inflate(this, R.layout.alert_integral, null);
        Window window = alertDialog.getWindow();
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        alertDialog.setView(inflate);
        alertDialog.show();
        EditText editintegral = inflate.findViewById(R.id.edit_integral);
        Button buttonaffirm = inflate.findViewById(R.id.button_affirm);
        buttonaffirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String integral = editintegral.getText().toString();
                if (TextUtils.isEmpty(integral)) {
                    Toast.makeText(DetailsJobActivity.this, "分数不能为空!", Toast.LENGTH_SHORT).show();
                    return;
                }
                Toast.makeText(DetailsJobActivity.this, "阅读点评完成", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent();
                intent.putExtra(integral, "integral");
                intent.setClass(DetailsJobActivity.this, JobsActivity.class);
                startActivity(intent);
            }

        });
    }
}
